import java.util.Scanner;
class School6 {
    private int year;
    private String name;

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}


public class java24 {
    public static void main(String[] args) {
        School school = new School();

        Scanner in = new Scanner(System.in);
        int x = 0;
        while (x < 3) {
            System.out.print("请输入学校的年份:");
            int year = in.nextInt();
            in.nextLine();
            while (!(year > 0 && year < 2023)) {
                System.out.println("年份不合法！");
                System.out.print("请再次输入学校的年份:");
                year = in.nextInt();
                in.nextLine();
            }
            school.setYear(year);
            System.out.print("请输入学校的名称:");
            school.setName(in.nextLine());
            System.out.println(school.getName() + " : " + school.getYear() + " 年 ");
            ++x;
        }
    }
}
